@using Bunit.TestAssets.SampleComponents
@inherits BunitContext

@code {
    public MarkupMatchesTest()
    {
        DefaultWaitTimeout = TimeSpan.FromSeconds(30);
    }

    [Fact]
    public void MarkupMatchesShouldNotBeBlockedByRenderer()
    {
        var tcs = new TaskCompletionSource<object?>();
        var cut = Render(@<LoadingComponent Task="@tcs.Task" />    );
        cut.MarkupMatches(@<span>loading</span>  );

        tcs.SetResult(true);

        cut.WaitForAssertion(() => cut.MarkupMatches(@<span>done</span>));
    }

    [Fact]
    public void MarkupMatchesShouldNotBeBlockedByRendererComplex()
    {
        var tcs = new TaskCompletionSource<object?>();
        var cut = Render(@<InvokeAsyncInsideContinueWith Task="@tcs.Task" /> );
        cut.MarkupMatches(@<span>waiting</span>);

        tcs.SetResult(true);

        cut.WaitForAssertion(() => cut.MarkupMatches(@<span>done</span>));
    }
}
